/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package agenda.database;

import agenda.entityes.AgeEntry;
import java.util.LinkedList;
import java.util.List;

/**
 * Database della rubrica.
 * @author emanuele
 */
public class AgeDB {

    String lastEdit;
    String ID;

    List<AgeEntry> entries = new LinkedList<AgeEntry>();

    public boolean addEntry(AgeEntry e){
        if (e==null || entries.contains(e)){
            return false;
        }
        return entries.add(e);
    }

    public boolean delEntry(AgeEntry e){
        return entries.remove(e);
    }

    public boolean contains(Object o){
        if (o == null) return false;
        for (AgeEntry x: entries){
            if (x.equals(o))
                return true;
        }
        return false;
    }

    public AgeEntry getEntry(Object o){
        if (o == null) return null;
        for (AgeEntry x: entries){
            if (x.equals(o))
                return x;
        }
        return null;
    }


}
